//
//  SXViewController.m
//  SunXi
//
//  Created by dllo on 15/11/26.
//  Copyright © 2015年 大远. All rights reserved.
//

#import "SXViewController.h"

@interface SXViewController ()

@end

@implementation SXViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.translucent = NO;
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"zuojiantou"] style:UIBarButtonItemStylePlain target:self action:@selector(presentLeftMenuViewController:)];
    [self.navigationItem.leftBarButtonItem setTintColor:BUTTONCOLOR];
    AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager];
    
    [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        
        switch (status) {
            case AFNetworkReachabilityStatusUnknown: // 未知网络
                NSLog(@"未知网络");
                self.NetworkState = NetUnknown;
                break;
                
            case AFNetworkReachabilityStatusNotReachable: // 没有网络(断网)
                NSLog(@"没有网络(断网)");
                self.NetworkState = NetDisconnect;
                break;
                // 手机自带网络
            case AFNetworkReachabilityStatusReachableViaWWAN:{
                NSLog(@"手机自带网络");
                self.NetworkState = NetTo2_3_4g;
                break;
            }
            case AFNetworkReachabilityStatusReachableViaWiFi: // WIFI
                self.NetworkState = NetWiFi;
                NSLog(@"WIFI");
                break;
        }
    }];
    
    [manager startMonitoring];
    UILabel *navigationLabel = [[UILabel alloc]init];
    @weakify(self);
    [self addColorChangedBlock:^{
        @strongify(self);
        navigationLabel.normalTextColor = [UIColor blackColor];
        navigationLabel.nightTextColor = [UIColor purpleColor];
        UIColor * color = navigationLabel.textColor;
        NSDictionary * dict = [NSDictionary dictionaryWithObject:color forKey:NSForegroundColorAttributeName];
        self.navigationController.navigationBar.titleTextAttributes = dict;
        
        self.navigationController.navigationBar.nightBarTintColor = [UIColor colorWithWhite:0.8 alpha:0.1];
        self.navigationController.navigationBar.normalBarTintColor = [UIColor whiteColor];

    }];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
